package day19;

import javax.swing.plaf.synth.SynthLookAndFeel;
import java.util.Scanner;

public class demo6 {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int k=in.nextInt();
        int sum=0;
        int[]arr=new int[n];
        for (int i = 0; i <n ; i++) {
            int x=in.nextInt();
            sum+=x;
            arr[i]=x;
        }
        int f=sum%k;
        if(f==0){
            System.out.println(sum);
            return;
        }



    }
}
